-Subproject commit a6f48a9720aa7b01b8abee1fc0eb78230b273485
+Subproject commit 1332d9713365a53fae76570a3c484753f9bcbb30
GVariantBuilder builder;
gboolean builder_initialized = FALSE;
- path = ot_gfile_get_path_cached (f);
+ path = gs_file_get_path_cached (f);
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ayay)"));
builder_initialized = TRUE;
gboolean ret = FALSE;
int i, n;
- path = ot_gfile_get_path_cached (f);
+ path = gs_file_get_path_cached (f);
n = g_variant_n_children (xattrs);
for (i = 0; i < n; i++)
{
mode = S_IFREG | 0664;
}
- dest_path = ot_gfile_get_path_cached (dest_file);
+ dest_path = gs_file_get_path_cached (dest_file);
if (S_ISDIR (mode))
{
- if (mkdir (ot_gfile_get_path_cached (dest_file), mode) < 0)
+ if (mkdir (gs_file_get_path_cached (dest_file), mode) < 0)
{
ot_util_set_error_from_errno (error, errno);
goto out;
ot_lfree guchar *ret_csum = NULL;
GString *tmp_name = NULL;
- tmp_name = create_tmp_string (ot_gfile_get_path_cached (dir),
+ tmp_name = create_tmp_string (gs_file_get_path_cached (dir),
prefix, suffix);
/* 128 attempts seems reasonable... */
dir = g_file_new_for_path (g_get_tmp_dir ());
template = g_strdup_printf ("%s/%s-XXXXXX",
- ot_gfile_get_path_cached (dir),
+ gs_file_get_path_cached (dir),
prefix ? prefix : "tmp");
if (mkdtemp (template) == NULL)
for (i = 0; i < modified->len; i++)
{
OstreeDiffItem *diff = modified->pdata[i];
- g_print ("M %s\n", ot_gfile_get_path_cached (diff->src));
+ g_print ("M %s\n", gs_file_get_path_cached (diff->src));
}
for (i = 0; i < removed->len; i++)
{
- g_print ("D %s\n", ot_gfile_get_path_cached (removed->pdata[i]));
+ g_print ("D %s\n", gs_file_get_path_cached (removed->pdata[i]));
}
for (i = 0; i < added->len; i++)
{
g_free (relpath);
}
else
- g_print ("A %s\n", ot_gfile_get_path_cached (added_f));
+ g_print ("A %s\n", gs_file_get_path_cached (added_f));
}
}
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
"No such file or directory: %s",
- ot_gfile_get_path_cached (self));
+ gs_file_get_path_cached (self));
return FALSE;
}
char *uri_path;
char *ret;
- path = ot_gfile_get_path_cached (file);
+ path = gs_file_get_path_cached (file);
uri_path = g_filename_to_uri (path, NULL, NULL);
g_assert (g_str_has_prefix (uri_path, "file://"));
ret = g_strconcat ("ostree://", self->commit, uri_path+strlen("file://"), NULL);
const char *parent_path;
const char *descendant_path;
- parent_path = ot_gfile_get_path_cached (parent);
- descendant_path = ot_gfile_get_path_cached (descendant);
+ parent_path = gs_file_get_path_cached (parent);
+ descendant_path = gs_file_get_path_cached (descendant);
remainder = match_prefix (descendant_path, parent_path);
if (remainder != NULL && G_IS_DIR_SEPARATOR (*remainder))
return TRUE;
const char *parent_path;
const char *descendant_path;
- parent_path = ot_gfile_get_path_cached (parent);
- descendant_path = ot_gfile_get_path_cached (descendant);
+ parent_path = gs_file_get_path_cached (parent);
+ descendant_path = gs_file_get_path_cached (descendant);
remainder = match_prefix (descendant_path, parent_path);
if (remainder != NULL && G_IS_DIR_SEPARATOR (*remainder))
{
case PROP_PATH:
/* Canonicalize */
- self->repodir = g_file_new_for_path (ot_gfile_get_path_cached (g_value_get_object (value)));
+ self->repodir = g_file_new_for_path (gs_file_get_path_cached (g_value_get_object (value)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
if (!ot_gfile_load_contents_utf8 (child, &ret_rev, NULL, NULL, &temp_error))
{
g_propagate_error (error, temp_error);
- g_prefix_error (error, "Couldn't open ref '%s': ", ot_gfile_get_path_cached (child));
+ g_prefix_error (error, "Couldn't open ref '%s': ", gs_file_get_path_cached (child));
goto out;
}
if (self->inited)
return TRUE;
- if (!g_file_test (ot_gfile_get_path_cached (self->objects_dir), G_FILE_TEST_IS_DIR))
+ if (!g_file_test (gs_file_get_path_cached (self->objects_dir), G_FILE_TEST_IS_DIR))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Couldn't find objects directory '%s'",
- ot_gfile_get_path_cached (self->objects_dir));
+ gs_file_get_path_cached (self->objects_dir));
goto out;
}
goto out;
self->config = g_key_file_new ();
- if (!g_key_file_load_from_file (self->config, ot_gfile_get_path_cached (self->config_file), 0, error))
+ if (!g_key_file_load_from_file (self->config, gs_file_get_path_cached (self->config_file), 0, error))
{
g_prefix_error (error, "Couldn't parse config file: ");
goto out;
if (!ostree_repo_check (self->parent_repo, error))
{
g_prefix_error (error, "While checking parent repository '%s': ",
- ot_gfile_get_path_cached (parent_repo_f));
+ gs_file_get_path_cached (parent_repo_f));
goto out;
}
}
gboolean ret = FALSE;
int fd = -1;
- if (!ot_unix_open_noatime (ot_gfile_get_path_cached (file), &fd, error))
+ if (!ot_unix_open_noatime (gs_file_get_path_cached (file), &fd, error))
goto out;
if (!ot_unix_fdatasync (fd, error))
goto out;
}
- if (rename (ot_gfile_get_path_cached (tempfile_path), ot_gfile_get_path_cached (dest)) < 0)
+ if (rename (gs_file_get_path_cached (tempfile_path), gs_file_get_path_cached (dest)) < 0)
{
if (errno != EEXIST)
{
ot_util_set_error_from_errno (error, errno);
g_prefix_error (error, "Storing file '%s': ",
- ot_gfile_get_path_cached (dest));
+ gs_file_get_path_cached (dest));
goto out;
}
}
*/
target_mode |= (S_IRUSR | S_IRGRP | S_IROTH);
- if (chmod (ot_gfile_get_path_cached (raw_temp_file), target_mode) < 0)
+ if (chmod (gs_file_get_path_cached (raw_temp_file), target_mode) < 0)
{
ot_util_set_error_from_errno (error, errno);
goto out;
ot_transfer_out_value(out_csum, &ret_csum);
out:
if (temp_file)
- (void) unlink (ot_gfile_get_path_cached (temp_file));
+ (void) unlink (gs_file_get_path_cached (temp_file));
if (raw_temp_file)
- (void) unlink (ot_gfile_get_path_cached (raw_temp_file));
+ (void) unlink (gs_file_get_path_cached (raw_temp_file));
g_clear_pointer (&checksum, (GDestroyNotify) g_checksum_free);
return ret;
}
if (!enumerator)
goto out;
- dirname = ot_gfile_get_basename_cached (objdir);
+ dirname = gs_file_get_basename_cached (objdir);
while ((file_info = g_file_enumerator_next_file (enumerator, cancellable, &temp_error)) != NULL)
{
a = archive_read_new ();
archive_read_support_compression_all (a);
archive_read_support_format_all (a);
- if (archive_read_open_filename (a, ot_gfile_get_path_cached (archive_f), 8192) != ARCHIVE_OK)
+ if (archive_read_open_filename (a, gs_file_get_path_cached (archive_f), 8192) != ARCHIVE_OK)
{
propagate_libarchive_error (error, a);
goto out;
ot_lobj GFileInfo *file_info = NULL;
GString *checksum = NULL;
- dirname = ot_gfile_get_basename_cached (dir);
+ dirname = gs_file_get_basename_cached (dir);
/* We're only querying name */
enumerator = g_file_enumerate_children (dir, "standard::name,standard::type",
ret_input = (GInputStream*) gs_file_read_noatime (loose_path, cancellable, error);
if (!ret_input)
{
- g_prefix_error (error, "Error opening loose file object %s: ", ot_gfile_get_path_cached (loose_path));
+ g_prefix_error (error, "Error opening loose file object %s: ", gs_file_get_path_cached (loose_path));
goto out;
}
}
object_path = ostree_repo_get_object_path (self, checksum, objtype);
- if (lstat (ot_gfile_get_path_cached (object_path), &stbuf) == 0)
+ if (lstat (gs_file_get_path_cached (object_path), &stbuf) == 0)
{
ret_stored_path = object_path;
object_path = NULL; /* Transfer ownership */
goto out;
}
- if (rename (ot_gfile_get_path_cached (temp_file), ot_gfile_get_path_cached (file)) < 0)
+ if (rename (gs_file_get_path_cached (temp_file), gs_file_get_path_cached (file)) < 0)
{
ot_util_set_error_from_errno (error, errno);
goto out;
ot_lobj GFile *dir = NULL;
if (dirfd != -1 &&
- linkat (-1, ot_gfile_get_path_cached (source),
- dirfd, ot_gfile_get_basename_cached (destination), 0) != -1)
+ linkat (-1, gs_file_get_path_cached (source),
+ dirfd, gs_file_get_basename_cached (destination), 0) != -1)
ret_was_supported = TRUE;
- else if (link (ot_gfile_get_path_cached (source), ot_gfile_get_path_cached (destination)) != -1)
+ else if (link (gs_file_get_path_cached (source), gs_file_get_path_cached (destination)) != -1)
ret_was_supported = TRUE;
else if (errno == EMLINK || errno == EXDEV || errno == EPERM)
{
*
* So we can't make this atomic.
*/
- (void) unlink (ot_gfile_get_path_cached (destination));
- if (link (ot_gfile_get_path_cached (source), ot_gfile_get_path_cached (destination)) < 0)
+ (void) unlink (gs_file_get_path_cached (destination));
+ if (link (gs_file_get_path_cached (source), gs_file_get_path_cached (destination)) < 0)
{
ot_util_set_error_from_errno (error, errno);
goto out;
continue;
}
- if (lstat (ot_gfile_get_path_cached (path), &stbuf) < 0)
+ if (lstat (gs_file_get_path_cached (path), &stbuf) < 0)
{
if (errno != ENOENT)
{
if (!ot_gfile_ensure_directory (objdir, TRUE, error))
{
g_prefix_error (error, "Creating cache directory %s: ",
- ot_gfile_get_path_cached (objdir));
+ gs_file_get_path_cached (objdir));
goto out;
}
&hardlink_supported, cancellable, error))
{
g_prefix_error (error, "Hardlinking loose object %s to %s: ", checksum,
- ot_gfile_get_path_cached (checkout_data->destination));
+ gs_file_get_path_cached (checkout_data->destination));
goto out;
}
}
input, cancellable, error))
{
g_prefix_error (error, "Copying object %s to %s: ", checksum,
- ot_gfile_get_path_cached (checkout_data->destination));
+ gs_file_get_path_cached (checkout_data->destination));
goto out;
}
}
cancellable, error))
goto out;
- checkout_data->dir_handle = opendir (ot_gfile_get_path_cached (checkout_data->destination));
+ checkout_data->dir_handle = opendir (gs_file_get_path_cached (checkout_data->destination));
if (!checkout_data->dir_handle)
{
ot_util_set_error_from_errno (error, errno);
{
ot_lobj GFile *objpath = NULL;
objpath = ot_gfile_get_child_build_path (objdir, g_file_info_get_name (file_info), NULL);
- if (!ot_gfile_unlink (objpath, cancellable, error))
+ if (!gs_file_unlink (objpath, cancellable, error))
goto out;
}
g_object_unref (file_info);
g_ptr_array_add (argv, "--mount-bind");
g_ptr_array_add (argv, "/dev");
g_ptr_array_add (argv, "/dev");
- g_ptr_array_add (argv, (char*)ot_gfile_get_path_cached (root));
+ g_ptr_array_add (argv, (char*)gs_file_get_path_cached (root));
}
g_ptr_array_add (argv, "ostree-run-triggers");
g_ptr_array_add (argv, NULL);
return g_file_resolve_relative_path (parent, path);
}
-/**
- * ot_gfile_unlink:
- * @path: Path to file
- * @cancellable: a #GCancellable
- * @error: a #GError
- *
- * Like g_file_delete(), except this function does not follow Unix
- * symbolic links, and will delete a symbolic link even if it's
- * pointing to a nonexistent file. In other words, this function
- * merely wraps the raw Unix function unlink().
- *
- * Returns: %TRUE on success, %FALSE on error
- */
-gboolean
-ot_gfile_unlink (GFile *path,
- GCancellable *cancellable,
- GError **error)
-{
- if (g_cancellable_set_error_if_cancelled (cancellable, error))
- return FALSE;
-
- if (unlink (ot_gfile_get_path_cached (path)) < 0)
- {
- ot_util_set_error_from_errno (error, errno);
- return FALSE;
- }
- return TRUE;
-}
-
-/**
- * ot_gfile_rename:
- * @from: Current path
- * @to: New path
- * @cancellable: a #GCancellable
- * @error: a #GError
- *
- * This function wraps the raw Unix function rename().
- *
- * Returns: %TRUE on success, %FALSE on error
- */
-gboolean
-ot_gfile_rename (GFile *from,
- GFile *to,
- GCancellable *cancellable,
- GError **error)
-{
- if (g_cancellable_set_error_if_cancelled (cancellable, error))
- return FALSE;
-
- if (rename (ot_gfile_get_path_cached (from),
- ot_gfile_get_path_cached (to)) < 0)
- {
- ot_util_set_error_from_errno (error, errno);
- return FALSE;
- }
- return TRUE;
-
-}
-
gboolean
ot_gfile_load_contents_utf8 (GFile *file,
char **out_contents,
return ret;
}
-const char *
-ot_gfile_get_path_cached (GFile *file)
-{
- const char *path;
-
- path = g_object_get_data ((GObject*)file, "ostree-file-path");
- if (!path)
- {
- path = g_file_get_path (file);
- g_object_set_data_full ((GObject*)file, "ostree-file-path", (char*)path, (GDestroyNotify)g_free);
- }
- return path;
-}
-
-
-const char *
-ot_gfile_get_basename_cached (GFile *file)
-{
- const char *name;
-
- name = g_object_get_data ((GObject*)file, "ostree-file-name");
- if (!name)
- {
- name = g_file_get_basename (file);
- g_object_set_data_full ((GObject*)file, "ostree-file-name", (char*)name, (GDestroyNotify)g_free);
- }
- return name;
-}
-
gboolean
ot_gio_write_update_checksum (GOutputStream *out,
gconstpointer data,
cancellable, error))
goto out;
*/
- if (chmod (ot_gfile_get_path_cached (dest_child),
+ if (chmod (gs_file_get_path_cached (dest_child),
g_file_info_get_attribute_uint32 (file_info, "unix::mode")) == -1)
{
ot_util_set_error_from_errno (error, errno);
else
{
gboolean did_link = FALSE;
- (void) unlink (ot_gfile_get_path_cached (dest_child));
+ (void) unlink (gs_file_get_path_cached (dest_child));
if (use_hardlinks)
{
- if (link (ot_gfile_get_path_cached (src_child), ot_gfile_get_path_cached (dest_child)) == -1)
+ if (link (gs_file_get_path_cached (src_child), gs_file_get_path_cached (dest_child)) == -1)
{
if (!(errno == EMLINK || errno == EXDEV))
{
}
else
{
- if (!ot_gfile_unlink (subpath, cancellable, error))
+ if (!gs_file_unlink (subpath, cancellable, error))
goto out;
}
g_clear_object (&file_info);
GFile *ot_gfile_get_child_build_path (GFile *parent, const char *first, ...) G_GNUC_NULL_TERMINATED;
-const char *ot_gfile_get_path_cached (GFile *file);
-
-const char *ot_gfile_get_basename_cached (GFile *file);
-
gboolean ot_gfile_ensure_directory (GFile *dir, gboolean with_parents, GError **error);
-gboolean ot_gfile_rename (GFile *src,
- GFile *dest,
- GCancellable *cancellable,
- GError **error);
-
-gboolean ot_gfile_unlink (GFile *path,
- GCancellable *cancellable,
- GError **error);
-
gboolean ot_gfile_load_contents_utf8 (GFile *file,
char **contents_out,
char **etag_out,
GMappedFile *mfile = NULL;
int fd;
- path = ot_gfile_get_path_cached (src);
+ path = gs_file_get_path_cached (src);
if (!ot_unix_open_noatime (path, &fd, error))
goto out;
mfile = g_mapped_file_new_from_fd (fd, FALSE, error);
ot_transfer_out_value (out_contents, &ret_contents);
out:
if (tmpf)
- (void) unlink (ot_gfile_get_path_cached (tmpf));
+ (void) unlink (gs_file_get_path_cached (tmpf));
return ret;
}
destroy_fetch_one_content_item_data (OtFetchOneContentItemData *data)
{
if (data->meta_path)
- (void) ot_gfile_unlink (data->meta_path, NULL, NULL);
+ (void) gs_file_unlink (data->meta_path, NULL, NULL);
g_clear_object (&data->meta_path);
if (data->content_path)
- (void) ot_gfile_unlink (data->content_path, NULL, NULL);
+ (void) gs_file_unlink (data->content_path, NULL, NULL);
g_clear_object (&data->content_path);
g_free (data->checksum);
g_free (data);
g_variant_ref (fetch_data->object));
ot_worker_queue_release (pull_data->metadata_objects_to_scan);
- (void) ot_gfile_unlink (fetch_data->temp_path, NULL, NULL);
+ (void) gs_file_unlink (fetch_data->temp_path, NULL, NULL);
g_object_unref (fetch_data->temp_path);
g_variant_unref (fetch_data->object);
g_free (fetch_data);
if (g_file_equal (current_deployment, deploy_target))
{
- g_print ("ostadmin: %s already points to %s\n", ot_gfile_get_path_cached (current_path),
+ g_print ("ostadmin: %s already points to %s\n", gs_file_get_path_cached (current_path),
relative_current);
return TRUE;
}
tmp_previous_path = g_file_get_child (self->ostree_dir, "tmp-previous");
- (void) ot_gfile_unlink (tmp_previous_path, NULL, NULL);
+ (void) gs_file_unlink (tmp_previous_path, NULL, NULL);
relative_previous = g_file_get_relative_path (self->ostree_dir, current_deployment);
g_assert (relative_previous);
- if (symlink (relative_previous, ot_gfile_get_path_cached (tmp_previous_path)) < 0)
+ if (symlink (relative_previous, gs_file_get_path_cached (tmp_previous_path)) < 0)
{
ot_util_set_error_from_errno (error, errno);
goto out;
}
tmp_current_path = g_file_get_child (self->ostree_dir, "tmp-current");
- (void) ot_gfile_unlink (tmp_current_path, NULL, NULL);
+ (void) gs_file_unlink (tmp_current_path, NULL, NULL);
- if (symlink (relative_current, ot_gfile_get_path_cached (tmp_current_path)) < 0)
+ if (symlink (relative_current, gs_file_get_path_cached (tmp_current_path)) < 0)
{
ot_util_set_error_from_errno (error, errno);
goto out;
}
tmp_current_etc_path = g_file_get_child (self->ostree_dir, "tmp-current-etc");
- (void) ot_gfile_unlink (tmp_current_etc_path, NULL, NULL);
- if (symlink (relative_current_etc, ot_gfile_get_path_cached (tmp_current_etc_path)) < 0)
+ (void) gs_file_unlink (tmp_current_etc_path, NULL, NULL);
+ if (symlink (relative_current_etc, gs_file_get_path_cached (tmp_current_etc_path)) < 0)
{
ot_util_set_error_from_errno (error, errno);
goto out;
}
- if (!ot_gfile_rename (tmp_current_path, current_path,
- cancellable, error))
+ if (!gs_file_rename (tmp_current_path, current_path,
+ cancellable, error))
goto out;
- if (!ot_gfile_rename (tmp_current_etc_path, current_etc_path,
- cancellable, error))
+ if (!gs_file_rename (tmp_current_etc_path, current_etc_path,
+ cancellable, error))
goto out;
if (tmp_previous_path)
{
- if (!ot_gfile_rename (tmp_previous_path, previous_path,
- cancellable, error))
+ if (!gs_file_rename (tmp_previous_path, previous_path,
+ cancellable, error))
goto out;
}
- g_print ("ostadmin: %s set to %s\n", ot_gfile_get_path_cached (current_path),
+ g_print ("ostadmin: %s set to %s\n", gs_file_get_path_cached (current_path),
relative_current);
ret = TRUE;
/**
* ensure_unlinked:
*
- * Like ot_gfile_unlink(), but return successfully if the file doesn't
+ * Like gs_file_unlink(), but return successfully if the file doesn't
* exist.
*/
static gboolean
gboolean ret = FALSE;
GError *temp_error = NULL;
- if (!ot_gfile_unlink (path, cancellable, &temp_error))
+ if (!gs_file_unlink (path, cancellable, &temp_error))
{
if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
{
ot_lfree char *etc_name;
ot_lobj GFile *parent;
- etc_name = g_strconcat (ot_gfile_get_basename_cached (previous_deployment), "-etc", NULL);
+ etc_name = g_strconcat (gs_file_get_basename_cached (previous_deployment), "-etc", NULL);
parent = g_file_get_parent (previous_deployment);
previous_deployment_etc = g_file_get_child (parent, etc_name);
ProcessOneCheckoutData checkout_data;
g_print ("ostadmin: Creating deployment %s\n",
- ot_gfile_get_path_cached (deploy_target_path));
+ gs_file_get_path_cached (deploy_target_path));
memset (&checkout_data, 0, sizeof (checkout_data));
checkout_data.loop = g_main_loop_new (NULL, TRUE);
cancellable, error))
goto out;
- g_print ("ostadmin: Created %s\n", ot_gfile_get_path_cached (deploy_target_etc_path));
+ g_print ("ostadmin: Created %s\n", gs_file_get_path_cached (deploy_target_etc_path));
if (previous_deployment_etc)
{
else
g_print ("ostadmin: No previous deployment; therefore, no configuration changes to merge\n");
- if (!ot_gfile_rename (deploy_target_path_tmp, deploy_target_path,
- cancellable, error))
+ if (!gs_file_rename (deploy_target_path_tmp, deploy_target_path,
+ cancellable, error))
goto out;
}
args = g_ptr_array_new ();
ot_ptrarray_add_many (args, "ostree", "admin",
- "--ostree-dir", ot_gfile_get_path_cached (self->ostree_dir),
+ "--ostree-dir", gs_file_get_path_cached (self->ostree_dir),
"update-kernel",
- ot_gfile_get_path_cached (deploy_path), NULL);
+ gs_file_get_path_cached (deploy_path), NULL);
if (opt_no_kernel)
g_ptr_array_add (args, "--modules-only");
g_ptr_array_add (args, NULL);
- if (!ot_spawn_sync_checked (ot_gfile_get_path_cached (self->ostree_dir),
+ if (!ot_spawn_sync_checked (gs_file_get_path_cached (self->ostree_dir),
(char**)args->pdata, NULL, G_SPAWN_SEARCH_PATH,
NULL, NULL, NULL, NULL, error))
goto out;
if (!g_file_query_exists (deployment, NULL))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Deployment %s doesn't exist", ot_gfile_get_path_cached (deployment));
+ "Deployment %s doesn't exist", gs_file_get_path_cached (deployment));
goto out;
}
}
orig_etc_path = g_file_resolve_relative_path (deployment, "etc");
deploy_parent = g_file_get_parent (deployment);
new_etc_path = ot_gfile_get_child_strconcat (deploy_parent,
- ot_gfile_get_basename_cached (deployment),
+ gs_file_get_basename_cached (deployment),
"-etc", NULL);
modified = g_ptr_array_new_with_free_func ((GDestroyNotify) ostree_diff_item_unref);
if (!ot_admin_ensure_initialized (ostree_dir, cancellable, error))
goto out;
- g_print ("%s initialized as OSTree root\n", ot_gfile_get_path_cached (ostree_dir));
+ g_print ("%s initialized as OSTree root\n", gs_file_get_path_cached (ostree_dir));
ret = TRUE;
out:
continue;
parent = g_file_get_parent (deployment);
- deployment_etc = ot_gfile_get_child_strconcat (parent, ot_gfile_get_basename_cached (deployment),
+ deployment_etc = ot_gfile_get_child_strconcat (parent, gs_file_get_basename_cached (deployment),
"-etc", NULL);
- g_print ("Deleting deployment %s\n", ot_gfile_get_path_cached (deployment));
+ g_print ("Deleting deployment %s\n", gs_file_get_path_cached (deployment));
if (!ot_gio_shutil_rm_rf (deployment, cancellable, error))
goto out;
/* Note - not atomic; we may be leaving the -etc directory around
ot_lptrarray GPtrArray *prune_argv = NULL;
ot_lfree char *repo_arg = NULL;
- repo_arg = g_strconcat ("--repo=", ot_gfile_get_path_cached (repo_path), NULL);
+ repo_arg = g_strconcat ("--repo=", gs_file_get_path_cached (repo_path), NULL);
prune_argv = g_ptr_array_new ();
ot_ptrarray_add_many (prune_argv, "ostree", repo_arg, "prune", "--refs-only", "--depth=0", NULL);
g_ptr_array_add (prune_argv, NULL);
- if (!ot_spawn_sync_checked (ot_gfile_get_path_cached (ostree_dir),
+ if (!ot_spawn_sync_checked (gs_file_get_path_cached (ostree_dir),
(char**)prune_argv->pdata, NULL, G_SPAWN_SEARCH_PATH,
NULL, NULL, NULL, NULL, error))
goto out;
subproc_args = g_ptr_array_new ();
{
ot_lfree char *repo_arg = g_strconcat ("--repo=",
- ot_gfile_get_path_cached (repo_path),
+ gs_file_get_path_cached (repo_path),
NULL);
ot_ptrarray_add_many (subproc_args, "ostree", "pull", repo_arg, remote_name, NULL);
g_ptr_array_add (subproc_args, NULL);
- if (!ot_spawn_sync_checked (ot_gfile_get_path_cached (ostree_dir),
+ if (!ot_spawn_sync_checked (gs_file_get_path_cached (ostree_dir),
(char**)subproc_args->pdata, NULL, G_SPAWN_SEARCH_PATH,
NULL, NULL, NULL, NULL, error))
goto out;
subproc_args = g_ptr_array_new ();
{
ot_lfree char *opt_ostree_dir_arg = g_strconcat ("--ostree-dir=",
- ot_gfile_get_path_cached (ostree_dir),
+ gs_file_get_path_cached (ostree_dir),
NULL);
ot_ptrarray_add_many (subproc_args, "ostree", "admin", opt_ostree_dir_arg, "deploy",
deploy_name, NULL);
g_ptr_array_add (subproc_args, NULL);
- if (!ot_spawn_sync_checked (ot_gfile_get_path_cached (ostree_dir),
+ if (!ot_spawn_sync_checked (gs_file_get_path_cached (ostree_dir),
(char**)subproc_args->pdata, NULL, G_SPAWN_SEARCH_PATH,
NULL, NULL, NULL, NULL, error))
goto out;
"--mount-readonly", "/",
"--mount-proc", "/proc",
"--mount-bind", "/dev", "/dev",
- "--mount-bind", ot_gfile_get_path_cached (ostree_vardir), "/var",
- "--mount-bind", ot_gfile_get_path_cached (tmpdir), "/tmp",
- "--mount-bind", ot_gfile_get_path_cached (ostree_moduledir), "/lib/modules",
+ "--mount-bind", gs_file_get_path_cached (ostree_vardir), "/var",
+ "--mount-bind", gs_file_get_path_cached (tmpdir), "/tmp",
+ "--mount-bind", gs_file_get_path_cached (ostree_moduledir), "/lib/modules",
deploy_path,
"dracut", "-f", "/tmp/initramfs-ostree.img", release,
NULL);
if (!g_file_copy (initramfs_tmp_file, initramfs_file, 0, cancellable, NULL, NULL, error))
goto out;
- g_print ("Created: %s\n", ot_gfile_get_path_cached (initramfs_file));
+ g_print ("Created: %s\n", gs_file_get_path_cached (initramfs_file));
- (void) ot_gfile_unlink (initramfs_tmp_file, NULL, NULL);
- (void) rmdir (ot_gfile_get_path_cached (tmpdir));
+ (void) gs_file_unlink (initramfs_tmp_file, NULL, NULL);
+ (void) rmdir (gs_file_get_path_cached (tmpdir));
}
ret = TRUE;
}
grubby_args = g_ptr_array_new ();
- add_kernel_arg = g_strconcat ("--add-kernel=", ot_gfile_get_path_cached (kernel_path), NULL);
+ add_kernel_arg = g_strconcat ("--add-kernel=", gs_file_get_path_cached (kernel_path), NULL);
initramfs_arg = g_strconcat ("--initrd=", "/boot/initramfs-ostree-", release, ".img", NULL);
ot_ptrarray_add_many (grubby_args, "grubby", "--grub", add_kernel_arg, initramfs_arg,
"--copy-default", "--title=OSTree", NULL);
if (!g_file_query_exists (dir, NULL))
{
ot_lfree char *opt_repo_arg = g_strdup_printf ("--repo=%s/repo",
- ot_gfile_get_path_cached (ostree_dir));
+ gs_file_get_path_cached (ostree_dir));
const char *child_argv[] = { "ostree", opt_repo_arg, "init", NULL };
if (!ot_spawn_sync_checked (NULL, (char**)child_argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL,
dir = ot_gfile_get_child_build_path (ostree_dir, "var", "tmp", NULL);
if (!ot_gfile_ensure_directory (dir, TRUE, error))
goto out;
- if (chmod (ot_gfile_get_path_cached (dir), 01777) < 0)
+ if (chmod (gs_file_get_path_cached (dir), 01777) < 0)
{
ot_util_set_error_from_errno (error, errno);
goto out;
g_clear_object (&dir);
dir = ot_gfile_get_child_build_path (ostree_dir, "var", "run", NULL);
- if (!g_file_test (ot_gfile_get_path_cached (dir), G_FILE_TEST_IS_SYMLINK))
+ if (!g_file_test (gs_file_get_path_cached (dir), G_FILE_TEST_IS_SYMLINK))
{
- if (symlink ("../run", ot_gfile_get_path_cached (dir)) < 0)
+ if (symlink ("../run", gs_file_get_path_cached (dir)) < 0)
{
ot_util_set_error_from_errno (error, errno);
goto out;
g_variant_unref (xattrs);
}
- g_string_append (buf, ot_gfile_get_path_cached (f));
+ g_string_append (buf, gs_file_get_path_cached (f));
if (type == G_FILE_TYPE_SYMBOLIC_LINK)
g_string_append_printf (buf, " -> %s", g_file_info_get_attribute_byte_string (file_info, "standard::symlink-target"));
if (!ostree_repo_file_ensure_resolved ((OstreeRepoFile*)f, NULL))
g_assert_not_reached ();
- path = ot_gfile_get_path_cached (f);
+ path = gs_file_get_path_cached (f);
fwrite (path, 1, strlen (path), stdout);
fwrite ("\0", 1, 1, stdout);
cancellable, error)) == NULL)
goto out;
- if (!ot_gfile_unlink (objf, cancellable, error))
+ if (!gs_file_unlink (objf, cancellable, error))
goto out;
data->freed_bytes += g_file_info_get_size (info);